package com.animallife.android.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

import com.animallife.android.R;
import com.animallife.android.util.Config;
import com.flurry.android.FlurryAgent;
import com.google.ads.AdRequest;
import com.google.ads.AdSize;
import com.google.ads.AdView;

public class HomeActivity extends Activity {

	private static final String ADS_ID = "a14f020d1132ab5";

	public void onStart() {
		super.onStart();
		FlurryAgent.onStartSession(this, "CJVA21QV9JQKNUQS93F9");
	}

	public void onStop() {
		super.onStop();
		FlurryAgent.onEndSession(this);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.home);
		overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);

		LinearLayout layout = (LinearLayout) findViewById(R.id.ads);
		AdView adView = new AdView(this, AdSize.BANNER, ADS_ID);
		layout.addView(adView);
		AdRequest request = new AdRequest();
		// request.setTesting(true);
		adView.loadAd(request);

	}

	public void openList(View view) {
		Intent intent = new Intent(getApplicationContext(), AnimalListActivity.class);
		switch (view.getId()) {
		case R.id.mammalia_button:
			intent.putExtra(Config.ANIMAL_TYPE, Config.MAMMALIA_TOKEN);
			break;
		case R.id.bird_button:
			intent.putExtra(Config.ANIMAL_TYPE, Config.BIRD_TOKEN);
			break;
		case R.id.reptiles_button:
			intent.putExtra(Config.ANIMAL_TYPE, Config.REPTILES_TOKEN);
			break;
		default:
			break;

		}
		startActivity(intent);
	}

}
